package com.bw.module_repair.adapter

import android.graphics.Color
import android.widget.TextView
import com.bw.lib_common.entity.RepairEntityItem
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.module_repair.R
/**
 * 智慧园区-01-设备管理V1.1-20250507
 */
class RepairAdapter :BaseQuickAdapter<RepairEntityItem,BaseViewHolder>(R.layout.layout_repair_item) {
    override fun convert(holder: BaseViewHolder, item: RepairEntityItem) {
        holder.setText(R.id.tv_repair_id,"工单号:${item.orderNumber}")
        holder.setText(R.id.tv_repair_name,"报修人:${item.repairName}")
        holder.setText(R.id.tv_repair_time,"报修时间:${item.repairTime}")
        holder.setText(R.id.tv_repair_location,"位置:${item.repairLocation}")
        holder.setText(R.id.tv_repair_status,"${item.processingStatus}")
        holder.setText(R.id.tv_repair_phone,"联系电话:${item.contactMethod}")
        holder.setText(R.id.tv_repair_desc_detail,"${item.faultDescription}")
        when (item.processingStatus) {
            "待处理" -> {
                holder.setTextColor(R.id.tv_repair_status, Color.parseColor("#F57C00"))
                holder.setBackgroundResource(R.id.tv_repair_status,R.drawable.shape_repair_status1)
            }
            "处理中" -> {
                holder.setTextColor(R.id.tv_repair_status,Color.parseColor("#1E88E5"))
                holder.setBackgroundResource(R.id.tv_repair_status,R.drawable.shape_repair_status2)
            }
            "已完成" -> {
                holder.setTextColor(R.id.tv_repair_status,Color.parseColor("#43A047"))
                holder.setBackgroundResource(R.id.tv_repair_status,R.drawable.shape_repair_status3)
            }
         }
    }
}